package io;

import java.io.*;

public class Test7 {
    public static void main(String[] args) throws IOException {
        File file = new File("./src/main/java/io");
        FileFilter filter = new FileFilter() {
            @Override
            public boolean accept(File file) {
                String name = file.getName();
                System.out.println("正在过滤的项目是：" + name);
                return name.endsWith(".java");
            }
        };
        File[] subs = file.listFiles(filter);

        for (int i = 0; i < subs.length; i++) {
            FileInputStream fis = new FileInputStream(subs[i]);
            InputStreamReader isr = new InputStreamReader(fis);
            BufferedReader br = new BufferedReader(isr);
            String line;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
            br.close();
        }
    }
}

